Ext.define('AM.controller.Users', {
    extend: 'Ext.app.Controller',
    stores: [
             'Users',
             'Merchants',
             'PaymentAgents',
             'Locations',
             'Permissions'
         ],
    views: [
            'user.List',
            'user.Edit'
    ],
    init: function() {
    	this.control({
        	'userList': {
                itemclick: this.editUser
            },
	        'button[action=resetUserForm]': {
	            click: this.resetUserForm
	        },
	        
        });
    },
    
    editUser: function(grid, record) {
    	Ext.getCmp('editUserForm').getForm().loadRecord(record);
        
    },
    resetUserForm: function(button) {
    	Ext.getCmp('editUserForm').getForm().reset();
        
    }
    
    
    /*,
    updateUser: function(button) {
        console.log('clicked the Save button');
	    var win    = button.up('window'),
        form   = win.down('form'),
        record = form.getRecord(),
        values = form.getValues();

	    record.set(values);
	    win.close();
	    // synchronize the store after editing the record
	    this.getUsersStore().sync();
    }
    */
});